package student_system.Controller;

import student_system.Dao.scdao;
import student_system.bean.sc;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/sc_delete")
public class sc_delete extends HttpServlet {
    scdao dao=new scdao();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.doPost(req, resp);
        String sno = req.getParameter("sno");
        String con = req.getParameter("cno");
        System.out.println("{" + sno + " " + con + "}");
         dao.delete(sno, con);
        List<sc> list = dao.testArrayList();
        req.setAttribute("sclist", list);

        RequestDispatcher dispatcher = req.getRequestDispatcher("scall.jsp");
        dispatcher.forward(req, resp);
    }
}
